package main

import (
	"database/sql"
	"fmt"

	_ "github.com/go-sql-driver/mysql"
)

//删除数据
type Doctor struct {
	id      int
	name    string
	age     int
	sex     int
	addTime string
}

func main() {
	db, err := sql.Open("mysql", "ding:dyw20020304@tcp(81.68.186.20:3306)/Ding?charset=utf8&parseTime=True")
	if err != nil {
		fmt.Println("sql.Open err = ", err)
		return
	}
	defer db.Close()
	result, err := db.Exec("delete from doctor_tb where id = ?", 1)
	if err != nil {
		fmt.Println("db.Exec err = ", err)
		return
	}
	rows, err := result.RowsAffected()
	if err != nil {
		fmt.Println("result.RowsAffected err = ", err)
		return
	}
	if rows > 0 {
		fmt.Println("删除成功")
	}
}
